home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 01.rexx next >
Encoding:
OS/2 REXX Batch file  |  1997-06-16  |  7.4 KB  |  349 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. Feather = strip(line)
  22. line = readln(TempFile)
  23. FireType = strip(line)
  24. line = readln(TempFile)
  25. Style = strip(line)
  26. line = readln(TempFile)
  27. FireNum = strip(line)
  28. line = readln(TempFile)
  29. ZoomType = strip(line)
  30. line = readln(TempFile)
  31. CircleType = strip(line)
  32. line = readln(TempFile)
  33. XOff = strip(line)
  34. line = readln(TempFile)
  35. YOff = strip(line)
  36. call close (TempFile)
  37.  
  38. j=0
  39. TFrames = Frames
  40. if Field = 1 then TFrames = Frames*2
  41. do i = 1 to Frames
  42.     call open TempFile,"RAM:VFXNums",W
  43.     call writeln TempFile,right(i,5,'0')
  44.     call writeln TempFile,right(Frames,5,'0')
  45.     call close TempFile
  46.     f=0
  47.     Redraw Off
  48.     FieldSet = 0
  49.     if Padding ~= -1 & i = 1 then call PadIt(1)
  50.     call LoadB()
  51.     call LoadA()
  52.     j = j+ 1
  53.     call DoIt()
  54.     Redraw On
  55.     call SaveIt()
  56.         if Field = 1 then do
  57.             Redraw Off
  58.             FieldSet = 1
  59.             call LoadB()
  60.             call LoadA()
  61.             j = j + 1
  62.             call DoIt()
  63.             Redraw On
  64.             call SaveIt()
  65.             end 
  66.     if Padding ~= -1 & i = Frames then call PadIt(2)
  67.     end
  68.     if SaveType = 0 then do
  69.         if Padding = -1 then
  70.             call MakeIcon(SaveName,(Frames-10))
  71.         else
  72.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  73.         end
  74.     Undo On
  75. exit
  76.  
  77.  
  78.  
  79. PadIt:
  80. arg PadNum
  81.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  82.         Undo On
  83.         exit
  84.         end
  85.          if PadNum = 1 then do
  86.        if IAType = 0 then do
  87.         do Pad = Padding to 1 by -1
  88.             LoadBuffer PicAName Force StartA-(Pad-1)
  89.             call Switcher(TOSW)
  90.             call Switcher(MDV1)
  91.             Render Go
  92.                 call RecordAdd(SaveName,2,6,Compression)
  93.             end
  94.         end
  95.        if IAType = 1 then do
  96.         LoadBuffer PicAName Force 1
  97.         call Switcher(TOSW)
  98.         call Switcher(MDV1)
  99.         Render Go
  100.             call RecordAdd(SaveName,2*Padding,6,Compression)
  101.         end
  102.        if IAType = 2 then do
  103.         LoadBuffer PicAName Force
  104.         call Switcher(TOSW)
  105.         call Switcher(MDV1)
  106.         Render Go
  107.             call RecordAdd(SaveName,2*Padding,6,Compression)
  108.         end
  109.        if IAType = 3 then do
  110.         do Pad = Padding to 1 by -1
  111.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  112.             call Switcher(TOSW)
  113.             call Switcher(MDV1)
  114.             Render Go
  115.                 call RecordAdd(SaveName,2,6,Compression)
  116.             end
  117.         end
  118.     end 
  119.     else do
  120.        if IBType = 0 then do
  121.         do Pad = 1 to Padding
  122.             LoadBuffer PicBName Force StartB+Pad+Frames
  123.             call Switcher(TOSW)
  124.             call Switcher(MDV1)
  125.             Render Go
  126.                 call RecordAdd(SaveName,2,6,Compression)
  127.             end
  128.         end
  129.        if IBType = 1 then do
  130.         LoadBuffer PicBName Force 1
  131.         call Switcher(TOSW)
  132.         call Switcher(MDV1)
  133.         Render Go
  134.             call RecordAdd(SaveName,2*Padding,6,Compression)
  135.         end
  136.        if IBType = 2 then do
  137.         LoadBuffer PicBName Force
  138.         call Switcher(TOSW)
  139.         call Switcher(MDV1)
  140.         Render Go
  141.             call RecordAdd(SaveName,2*Padding,6,Compression)
  142.         end
  143.        if IBType = 3 then do
  144.         do Pad = 1 to Padding
  145.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  146.             call Switcher(TOSW)
  147.             call Switcher(MDV1)
  148.             Render Go
  149.                 call RecordAdd(SaveName,2,6,Compression)
  150.             end
  151.         end
  152.     end
  153. return
  154.  
  155. LoadA:
  156.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  157.         Undo On
  158.         exit
  159.         end
  160.     if j = TFrames then return
  161.     if IAType = 0 then do
  162.         LoadBuffer PicAName Force i+StartA
  163.         end
  164.     if IAType = 1 then do
  165.         LoadBuffer PicAName Force 1
  166.         end
  167.     if IAType = 2 then do
  168.         LoadBuffer PicAName Force
  169.         end
  170.     if IAType = 3 then do
  171.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  172.         end
  173.  
  174. return
  175.  
  176. LoadB:
  177.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  178.         Undo On
  179.         exit
  180.         end
  181.     if j = 1 then return
  182.     if IBType = 0 then do
  183.         LoadBuffer PicBName Force i+StartB
  184.         end
  185.     if IBType = 1 then do
  186.         LoadBuffer PicBName Force 1
  187.         end
  188.     if IBType = 2 then do
  189.         LoadBuffer PicBName Force
  190.         end
  191.     if IBType = 3 then do
  192.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  193.         end
  194.     Swap
  195. return
  196.  
  197.  
  198. DoIt:
  199.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  200.         Undo On
  201.         exit
  202.         end
  203.     if j = TFrames then do
  204.         Swap
  205.         return
  206.         end
  207.  
  208.     GetMain
  209.     parse var result Name Width Height Blah
  210.  
  211.     if j = 1 then do
  212.         HMiddle = Height/2
  213.         WMiddle = Width/2
  214.         xrad = 0
  215.         yrad = 0
  216.         xctr = XOff
  217.         yctr = YOff
  218.         if ZoomType = 1 then do
  219.             xctr = WMiddle
  220.             yctr = HMiddle
  221.             end
  222.         return
  223.         end
  224.  
  225.     if ZoomType = 1 then Swap
  226.  
  227.     AlphaChannel Off
  228.     Buffer2Alpha
  229.     SwapAlpha
  230.     Clearbuffer Force 0 0 0
  231.     EdgeMode FeatherOut Feather
  232.  
  233.     if CircleType = 0 then do
  234.         Num = (((j-1) * (Height - 10))/(TFrames-1))
  235.         Num = trunc(Num)
  236.         if ZoomType = 1 then Num = (Height-10)-Num
  237.         FilledOval Width/2 Height/2 Num Num
  238.         end
  239.     else do
  240.  
  241.         if XOff <= WMiddle then do
  242.             xrstp=(Width-XOff)/TFrames
  243.             xstp=(WMiddle-XOff)/TFrames
  244.             if ZoomType = 1 then xctr = xctr-xstp
  245.             else xctr = xctr+xstp
  246.             end
  247.           else do
  248.             xrstp=XOff/TFrames
  249.             xstp=(XOff-WMiddle)/TFrames
  250.             if ZoomType = 1 then xctr = xctr+xstp
  251.             else xctr = xctr-xstp
  252.             end
  253.  
  254.         if YOff >= HMiddle then do
  255.             yrstp=YOff/TFrames
  256.             ystp=(HMiddle-YOff)/TFrames
  257.             if ZoomType = 1 then yctr = yctr-ystp
  258.             else yctr = yctr+ystp
  259.             end
  260.           else do
  261.             yrstp=(Height-YOff)/TFrames
  262.             ystp=(YOff-HMiddle)/TFrames
  263.             if ZoomType = 1 then yctr = yctr+ystp
  264.             else yctr = yctr - ystp
  265.             end
  266.         xrad = (((j-1) * (495))/(TFrames-1))
  267.         xctr = trunc(xctr)
  268.         yctr = trunc(yctr)
  269.         xrad = trunc(xrad)
  270.         if ZoomType = 1 then do
  271.             xrad = 495-xrad
  272.             end
  273.         FilledOval xctr yctr xrad xrad
  274.         end
  275.  
  276.     EdgeMode Normal
  277.     SwapAlpha
  278.     AlphaChannel FRISKET
  279.     Merge 100 Alpha
  280.     AlphaChannel Off
  281.     NewFireNum = (((j-1) * (100))/(TFrames-1))
  282.     NewFireNum = trunc(NewFireNum)+5
  283.  
  284.     if Style = 0 then NewType = "Radial_Out"
  285.     if Style = 1 then NewType = "Radial_In"
  286.     if Style = 2 then do
  287.         NewType = "Radial_In"
  288.         NewFireNum = FireNum
  289.         end
  290.     if Style = 3 then do
  291.         NewType = "Radial_Out"
  292.         NewFireNum = FireNum
  293.         end
  294.     if CircleType = 0 then do
  295.         if FireType = 0 then
  296.             Hook Fire '9883516' '0' NewFireNum Width/2 Num Width/2 Height/2 '0' '50' '180' '0' '2' '1' Paint Wood NewType '100' '0' '20' '20' '0' '0' '0' '0' '0' '3'
  297.         if FireType = 1 then
  298.             Hook Fire '9883516' '0' NewFireNum Width/2 Num Width/2 Height/2 '0' '50' '180' '0' '2' '1' Paint Gas NewType '100' '0' '20' '20' '0' '0' '0' '0' '0' '3'
  299.         end
  300.     else do
  301.         if FireType = 0 then
  302.             Hook Fire '9883516' '0' NewFireNum Width/2 xrad xctr yctr '0' '50' '180' '0' '2' '1' Paint Wood NewType '100' '0' '20' '20' '0' '0' '0' '0' '0' '3'
  303.         if FireType = 1 then
  304.             Hook Fire '9883516' '0' NewFireNum Width/2 xrad xctr yctr '0' '50' '180' '0' '2' '1' Paint Gas NewType '100' '0' '20' '20' '0' '0' '0' '0' '0' '3'
  305.         end
  306. return
  307.  
  308. SaveIt:
  309.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  310.         Undo On
  311.         exit
  312.         end
  313.     if SaveType = 0 then do
  314.         call Switcher(TOSW)
  315.         call Switcher(MDV1)
  316.  
  317.         Render Go
  318.         if Field = 1 then
  319.                 call RecordAdd(SaveName,1,6,Compression)
  320.         else
  321.                 call RecordAdd(SaveName,2,6,Compression)
  322.         end
  323.  
  324.     if SaveType = 1 then do
  325.         if Field = 1 then do
  326.             f= f + 1
  327.             if f = 1 then
  328.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  329.             if f = 2 then do
  330.                 GetMain
  331.                 parse var result Name Width Height Blah
  332.                 Scale Width Height/2
  333.                 Swap
  334.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  335.                 Scale Width Height/2
  336.                 Hook Interlace
  337.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  338.                 f = 0
  339.                 end
  340.             end
  341.         else do
  342.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  343.             end    
  344.         end
  345.  
  346. return
  347.  
  348.  
  349.